//
//  PCDApiGetCurrentPages.m
//  PCDMPaasBank
//
//  Created by DK on 2021/4/9.
//  Copyright © 2021 Alibaba. All rights reserved.
//

#import "PCDApiGetCurrentPages.h"
#import "PCDDataBaseModel.h"
#import "PCDBankWebViewController.h"

@implementation PCDApiGetCurrentPages

- (void)handler:(id)data andContext:(PCDContext *)context ResponseCallback:(WVJBResponseCallback )responseCallback
{
    NSDictionary *tempDic = (NSDictionary *)data;
    NSString *callBack = [tempDic objectForKey:@"success"];
    NSArray *array =PCDPageViewMangeGet().baseNavgatView.viewControllers;
    int nCount =0;
    for (int i=0;i<array.count;i++) {
       
        UIViewController *tempView = [array objectAtIndex:i];
        if ([tempView isKindOfClass:[PCDBankWebViewController class]]) {
            nCount ++;
        }
    }
    NSString *strCount =[NSString stringWithFormat:@"%d",nCount];
    NSDictionary *params = @{@"number":strCount};
    
    if (![PCDUtil nilOrEmptyString:callBack]) {
        //
        evaluateJavaScriptOnMainThread(self,callBack,[params JSONRepresentation]);
    }
}

@end
